﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;

namespace Skyhook.Resources
{
    public static class ResourceFactory
    {
        static ResourceStorage Storage = ResourceStorage.Instance;

        public static T CreateFromFile<T>(string assetname) where T : Resource, new()
        {
            if (Storage.Contains<T>(assetname))
            {
                return Storage.Get<T>(assetname);
            }

            T resource = new T();
            resource.LoadFromFile(assetname);
            Storage.Add(resource);

            return resource;
        }
    }
}
